﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EventbriteService;
using EventbriteService.Model;
using EventbriteService.Adapter;
using EventbriteService.Factory;

namespace Eventbrite.LinqProvider
{
   public class EventbriteContext
    {
       IEventbriteClient  _client;
       IEventBriteConfiguration _configuration;
       EventbriteQuery<Event> _query;

       public EventbriteContext(string appKey)
       {
           _client = new LinqReader();
           _configuration = (IEventBriteConfiguration)_client;
           _configuration.AppKey = appKey;
          // _configuration.UserKey = userKey;
       }

           
       public IEventBriteConfiguration Configuration { get { return _configuration; } }

       public IEventbriteClient Client { get {return _client; }}

       public EventbriteQuery<Event> Query
       {
           get 
           {
               if (_query == null)
               {
                    _query = new EventbriteQuery<Event>(new QueryProvider(_client as IDataReader));
               }
               return _query;
            }
       }
    }
}
